#pragma once
#ifndef __glad_h_
  #include "Glad/glad/glad.h"
#endif
#include <cstdio>
#include <iostream>
#include "Component\Renderer\Base\RendererControl.h"
#include "Includes\SDefine.h"
namespace SakuraAge {
class Texture : 
  public RefBase<Texture>, public SakuraObject 
{
 friend class RefBase<Texture>;

 private:
  Texture(){}
  unsigned textureID;
  Vector2 m_size;

 public:
  READONLY_PROPERTY(Vector2, size);
  GET(size) { return size; }
  enum class SurroundMod {
    Repeat = GL_REPEAT,
    Mirror = GL_MIRRORED_REPEAT,
    ClampToEdge = GL_CLAMP_TO_EDGE,
    ClampToColor = GL_CLAMP_TO_BORDER
  };
  enum class Resolution { Linear = GL_LINEAR, Nearest = GL_NEAREST };
  struct TextureMode {
    SurroundMod surroundMod;
    Resolution resolution;
    float* color;
    bool deleteColor;
    TextureMode(SurroundMod sur, Resolution res, float* color = nullptr,
                bool deleteColor = false);
  };
  Texture(std::string path, TextureMode mode);
  void ReloadTexture(std::string path, TextureMode mode);
  void Bind();
  ~Texture();
};
}  // namespace SakuraAge
